$(function() {

	$("input[name='money']").val('价格:' + localStorage.place + '元')
	$("#examination_adress").val(localStorage.school_address);
	$("#money_model").val(localStorage.sign_type_name);

	var state = false;
	$(".agreement_sure").click(function() {
		if($(".gouxuan").eq(0).css("display") == "block") {
			$(".gouxuan").eq(0).css("display", "none");
			state = true;
		} else {
			$(".gouxuan").eq(0).css("display", "block");
		}
	});

	/*电话咨询*/
	 console.log(localStorage.man_phone);
	$("#phone_cal").click(function() {

		window.location.href = 'tel:'+localStorage.man_phone;

	});

	/*确认提交*/
	$("#sure_baoming").click(function() {
		/*计费方式*/
		localStorage.money_model = $("#money_model").val();
		localStorage.paytoken = localStorage.phone;
		localStorage.payschool_id = localStorage.school_id;
		localStorage.examination_name = $("#examination_name").val();
		localStorage.examination_no_phone = $("#examination_no_phone").val();

		if(localStorage.examination_name == "") {
			layer.msg("姓名不能为空");
			return false;
		}
		if(localStorage.examination_no_phone == "") {
			layer.msg("电话不能为空");
			return false;
		}
		var phone = document.getElementById('examination_no_phone').value;
		if(!(/^1[34578]\d{9}$/.test(phone))) {
			layer.msg("手机号码有误，请重填");
			return false;
		}
		if($(".gouxuan").eq(0).css("display", "block")) {

			window.location.href = '../payment/school_pay.html';
		}

	})

	/*1.********动态获取html根字体************/
	setFontSize()

});
/*1.********动态获取html根字体************/
var win = window,
	doc = document;

function setFontSize() {
	var winWidth = $(window).width();

	//750这个数字是根据你的设计图的实际大小来的，所以值具体根据设计图的大小
	var size = (winWidth / 640) * 100;
	doc.documentElement.style.fontSize = (size < 100 ? size : 100) + 'px';
};


